package sr.myserver.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.util.StringUtils;
import sr.myserver.entity.SysButtons;

import java.util.List;

/**
 * 查询主菜单结果
 *
 * @author sirui
 */
@Data
@ApiModel(value = "加载菜单响应对象", description = "加载菜单响应对象")
public class Menus {
    /**
     * 菜单标题
     */
    @Schema(description = "菜单标题")
    private String title;
    /**
     * url地址
     */
    @Schema(description = "url地址")
    private String key;
    /**
     * 显示图标
     */
    @Schema(description = "显示图标")
    private String icon;
    /**
     * 菜单主键
     */
    @Schema(description = "菜单主键")
    private String id;
    /**
     * 菜单绑定按钮主键集合
     */
    @Schema(description = "菜单绑定按钮主键集合")
    private String[] btnIds;
    /**
     * 菜单按钮信息
     */
    @Schema(description = "菜单按钮信息")
    private List<SysButtons> buttons;
    /**
     * 子级菜单信息
     */
    @Schema(description = "子级菜单信息")
    private List<Menus> children;

    public Menus() {
    }

    public Menus(String title, String key, String icon, String id, String[] btnIds, List<SysButtons> buttons) {
        this.title = title;
        this.btnIds = btnIds;
        this.buttons = buttons;
        this.icon = icon;
        this.id = id;
        if (!StringUtils.hasText(key)) {
            this.key = id;
        } else {
            this.key = key;
        }

    }
}
